up: programming - C - File I/O  
programming - C - function getsWhat links here?
prototype char *gets(char *s)

Description

The gets() function reads characters from stdin and loads them into the buffer pointed to by s. No additional characters are read after gets() has read a linefeed. A null character is written immediately after the last character that gets() reads into the buffer. Unlike fgets(), gets() does not copy the linefeed to the buffer.

Parameters



Return Values

If successful, gets() returns s, the address of the input buffer. If end-of-file is encountered and no characters have been read into the buffer, the buffer's contents remain unchanged and a null pointer is returned. If a read error occurs , a null pointer is returned and the error indicator for the stream is set. The functions ferror() and feof() can be used to distinguish error conditions from end-of-file.

On failure, errno is set to one of the following values:
EACCES Another process has the file locked.
EBADF stdin is not a valid stream opened for reading.
EINTR A signal interrupted the call.
EIO An input error occurred.
EISDIR The open object is a directory, rather than a file.
ENOMEM Memory could not be allocated for internal buffers.
ENXIO A device error occurred.
EOVERFLOW The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding stream.
EWOULDBLOCK The underlying file descriptor is a non-blocking socket and no data is ready to be read.
programming - C - function gets
filename:programming - C - function gets
filename:programming%20%2D%20C%20%2D%20function%20gets
last edit:December 18 2012 19:08:10 (4156 days ago)
ct = 1714959320.000000 = May 05 2024 21:35:20
ft = 1355875690.000000 = December 18 2012 19:08:10
dt = 359083630.000000